<template>
</template>

<script>
	export default {
		data() {
			return {}
		},
		methods: {
			scan() {
				uni.scanCode({
					onlyFromCamera: true,
					success: (res) => {
						console.log("二维码识别结果：", res.result)
						this.handleQRCodeContent(res.result)
					},
					fail: (err) => {
						console.log("二维码扫描失败", err)
					}
				})
				this.ifRecord = true
			},
			handleQRCodeContent(code) {
				const courseTimeId = code.split('_')[0]
				updateStuRecordApi({
					classRecordId: this.classRecord.id,
					courseTimeId: courseTimeId,
					studentId: this.studentId
				}).then((res) => {
					console.log('update', res)
					getStuRecordApi({
						classRecordId: this.classRecord.id,
						courseTimeId: courseTimeId,
						studentId: this.studentId
					}).then((stuRes) => {
						console.log('stu', stuRes)
						this.studentRecord = stuRes.data.rows[0]
						// this.ifRecord = true
					})
				})
			}
			
		}
	}
</script>

<style>
</style>